﻿using System;
namespace ChapterX.Common
{
    public class CommonDefinition
    {
        #region Digitization

        public enum DigitizationStatus : int
        {
            defaultStatus = 0, //未提交申请
            submitted = 1,     //已提交申请
            digitized = 2,     //已数字化

            denied = 3,        //申请未通过
            
            attachcourse = 4
        }

        public const String DigitizationStatus_Default = "未提交申请";
        public const String DigitizationStatus_Submitted = "已提交申请";
        //public const String DigitizationStatus_Digitizaing = "数字化中";
        public const String DigitizationStatus_Digitized = "已数字化";
        public const String DigitizationStatus_Denied = "申请未通过";

        public const String Digitization_CourseBook_Status_Digitized_UnAttaced = "教材已数字化，未关联课程";
        public const String Digitization_CourseBook_Status_Digitized_Attached = "已数字化";


        public const String OperationText_Default = "提交申请";
        public const String OperationText_Submitted = "待数字化";
        public const String OperationText_Submitted_Librarian = "去数字化";
        public const String OperationText_Digitized = "查看详情";
        public const String OperationText_Denied = "重新申请";


        public static String getStringDigitizationStatus(int ids)
        {
            if (ids == (int)DigitizationStatus.submitted)
                return DigitizationStatus_Submitted;
            else if (ids == (int)DigitizationStatus.digitized)
                return DigitizationStatus_Digitized;
            else if (ids == (int)DigitizationStatus.denied)
                return DigitizationStatus_Denied;
            else
                return DigitizationStatus_Default;
        }

        public static String getDigitizationAndCourseBookStatusValue(int dStautus)
        {
        //    if (dStautus == (int)DigitizationStatus.digitized)
        //    {
        //        if (cbStatus == (int)CourseBookStatus.attached)
        //            return Digitization_CourseBook_Status_Digitized_Attached;
        //        else
        //            return Digitization_CourseBook_Status_Digitized_UnAttaced;
        //    }
        //    else
        //        return getStringDigitizationStatus(dStautus);
            return "";

        }


        public const String DigitizationOperation_Submit = "提交数字化申请";
        public const String DigitizationOperation_Digitizing = "通过申请，数字化中";
        public const String DigitizationOperation_Digitized = "提交数字化结果";
        public const String DigitizationOperation_AttachCourse = "关联所属课程";
        public const String DigitizationOperation_Update = "更改数字化结果";
        public const String DigitizationOperation_Delete = "删除数字化结果";
        public const String DigitizationOperation_Deny = "未通过申请";
        
        #endregion

        #region CourseBookStatus

        public enum CourseBookStatus : int
        {
            defaultStatus = -1,
            unattached = 0,
            attached = 1
        }

        public static String getCourseBookStatusValue(int status)
        {
            if (status <= (int)CourseBookStatus.unattached)
            {
                return "未关联书籍数字化结果";
            }
            else if (status >= (int)CourseBookStatus.attached)
            {
                return "已关联书籍数字化结果";
            }
            else
            {
                return "未知状态";
            }
        }

        #endregion

        #region Path
        
        public static String getDigitizationDirectory(String isbn10)
        {
            return isbn10; 
        }

        public const String UPLOAD_FILE_DIRECTORY = "UploadFiles";
        
        #endregion

        public const String BOOK_CHAPTER_SIZE = "BCZ";

        public static bool GetAccessibilityValue(String accessibility)
        {
            if (accessibility.Equals("1"))
            {
                return true;
            }
            else
                return false;
        }
    }
}
